#include <bits/stdc++>
using namespace std;
int N,M,A[100010],X[100010],Y[100010];

int main()
{
 cin>>N>>M;

 for (int i=1; i<=N; i++){
    cin>>A[i];
    }

 for (int i=1; i<=M; i++){
    cin>>X[i]>>Y[i];
    }
     
 cout<<M*2<<endl;

 return 0;
}