#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, q;
cin >> n >> m >> q;
int a[n+1];
for(int i = 1; i <= n; i++){
cin >> a[i];
}
pair<int, int> p[q+1];
for(int i = 0; i < q; i++){
cin >> p[i].first >> p[i].second;
}
int l = 1, r = 1;
int cnt[m+1]={}, fix[n+1]={}, ans = 1e9;
while(l<=n&&r<=n){
if(fix[r]==0&&r<=n){
cnt[a[r]]++;
}
if(r<=n)fix[r] = 1;
bool t = 1;
for(int i = 0; i<q; i++){
if(cnt[p[i].first]<p[i].second) {
t=0;
break;
}
}
if(t){
ans = min(ans, r- l+1);
cnt[a[l]]--;
l++;
} else r++;
}
if(ans==1e9) cout <<"impossible";
else cout << ans ;
}