#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll n, k; cin >> n >> k;
ll d[k+3];
for ( int i = 1; i < k+1; i++ ){
    cin >> d[i];
}
if ( k == 1 ){
    cout << 1;
}
if ( k == 2 ){
    if ( d[1] == 1 ){
        if ( n == 2){
            cout << 1 << " " << 3;
        }
        else{
            cout << 1 << " " << n-1;
        }
    }
    else{
        if ( n == 2){
            cout << 3 << " " << 1;
        }
        else{
            cout << n - 1 << " " << 1;
        }
    }
}


return 0;
}