#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, r, liel = 0, peck = 0;
  bool ir;
  cin >> k >> r;
  char iev;
  for (long long i = 0; i < r; i++) {
    ir = false;
    for (long long a = 0; a < k; a++) {
      cin >> iev;
      if (iev == '0' && !ir) {
        ir = true;
        peck++;
      }
    }
    if (!ir) {
      liel = max(liel, peck);
      peck = 0;
    }
  }
  cout << max(liel, peck);
  return 0;
}
