#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> k >> n;
  vector<long long int> a(n);
  for (auto &it : a) cin >> it;
  long long totsum = 0, ans = 1e18, sum = 0;
  for (auto it : a) totsum += it;
  for (long long i = 0; i <= n; i++) {
    long long tnum = k;
    if (i) {
      sum += a[i - 1];
      tnum += sum;
    }
    if (tnum <= 0)
      ans = min(ans, i);
    else if (totsum >= 0)
      continue;
    else
      ans = min(ans, i + n * ((tnum + abs(totsum) - 1) / abs(totsum)));
  }
  if (ans != 1e18)
    cout << ans;
  else
    cout << -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  cin.get();
  return 0;
}
