#include <bits/stdc++.h>
using namespace std;
void solve() {
  int x, y, fin = 0, res = INT_MIN;
  cin >> x >> y;
  for (int i = 0; i < y; ++i) {
    string s;
    int cnt = 0;
    cin >> s;
    for (char c : s)
      if (c == '1') ++cnt;
    if (cnt != x)
      ++fin;
    else {
      res = max(fin, res);
      fin = 0;
    }
  }
  cout << max(res, fin) << endl;
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
