#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  int B;
  B = 0;
  for (int i = 0; i < M; i++) {
    B += A[i];
  }
  cout << N - B << endl;
  if (N - B >= 0) {
    cout << N - B << endl;
  } else
    cout << -1 << endl;
}
