#include <bits/stdc++.h>
using namespace std;
#define MAX 200200
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define __buitin_popcount __builtin_popcountll
#define BIT(x,i) (((x)>>(i))&1ll)
#define MASK(i) (1ll<<(i))
template<class X,class Y> bool maximize(X &x,Y y)
{
if(x<y)
{
x=y;
return 1;
}
return 0;
}
template<class X,class Y> bool minimize(X &x,Y y)
{
if(y<x)
{
x=y;
return 1;
}
return 0;
}
const int inf=1e9+412009;
const ll INF=2e18+412009;
int n,K,R;
int a[MAX];
int need[MAX];
void nhap()
{
memset(need,-0x3f,sizeof(need));
cin>>n>>K>>R;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=R;i++)
{
int x,y;
cin>>x>>y;
need[x]=y;
}
}
int cnt[MAX]={},ok=0;
void add(int x)
{
cnt[x]++;
if(cnt[x]==need[x]) ok++;
}
bool sub(int x)
{
if(cnt[x]<=need[x]) return 0;
cnt[x]--;
return 1;
}
void solve()
{
for(int i=0;i<K;i++) if(need[i]<=-inf) ok++;
int res=inf;
int T1=1;
for(int i=1;i<=n;i++)
{
add(a[i]);
while(T1<=n&&sub(a[T1])) T1++;
if(ok==K) minimize(res,i-T1+1);
}
if(res>=inf) cout<<"impossible";
else cout<<res;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
nhap();
solve();
return 0;
}