#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long int H, s, min_h;
  int n, i, j, d;
  cin >> H >> n;
  vector<int> damage;
  s = 0;
  min_h = H;
  for (i = 0; i < n; ++i) {
    cin >> d;
    s += d;
    if (H + s < min_h) {
      min_h = H + s;
    }
    damage.push_back(d);
  }
  if ((min_h > 0) && (s >= 0)) {
    cout << -1;
    return 0;
  }
  long long int ans = 0;
  s = -s;
  if (min_h > 0) {
    long long int r = ((min_h / s) + ((min_h % s) != 0));
    ans += r * n;
    H -= r * s;
  }
  if (H > 0) {
    for (i = 0; i < n; ++i) {
      H += damage[i];
      if (H <= 0) {
        break;
      }
    }
    ans += i + 1;
  }
  cout << ans;
  return 0;
}
