When the immune system encounters a specific foreign agents (e.g. A microbe or foreign molecule for the first time, it generates immune response and eliminates the invading pathogen. (This is the first encounter)
The immune system retains the memory of the first encounter.
As a result, a second encounter with the same organism evokes a heightened immune response. (Second encounter)
The second encounter takes place more quickly and abundantly than the first one.