#include <bits/stdc++.h>
using namespace std;
template <typename T>
T id(T b) {
  return b;
};
template <class It>
bool all(It f, It l) {
  return std::all_of(f, l, id<bool>);
}
template <class It>
bool any(It f, It l) {
  return std::any_of(f, l, id<bool>);
}
template <typename T>
void chmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
void chmin(T &x, T y) {
  if (x > y) x = y;
}
const int MAX_N = 200000;
long long h;
int n;
long long d[MAX_N];
int main() {
  cin >> h >> n;
  for (int i = 0; i < int(n); i++) cin >> d[i];
  long long max_d = 0;
  long long g = h;
  for (int i = 0; i < n; i++) {
    g += d[i];
    if (g <= 0) {
      cout << (i + 1) << "\n";
      return 0;
    }
    chmax(max_d, h - g);
  }
  if (g >= h) {
    cout << "-1\n";
    return 0;
  }
  long long c = (h - max_d) / (h - g);
  if ((h - max_d) % (h - g) != 0) c++;
  long long m = c * n;
  h -= (h - g) * c;
  for (int i = 0; i < n && h > 0; i++) {
    h += d[i];
    m++;
  }
  cout << m << "\n";
  return 0;
}
