#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, start = 0;
  cin >> n >> d;
  vector<string> s(d);
  for (string &e : s) cin >> e;
  vector<int> win(d);
  for (int i = 0; i < s.size(); i++) {
    string q = s[i];
    if (q.find('0') <= q.length()) {
      win[start]++;
    } else {
      start++;
    }
  }
  sort(win.begin(), win.end(), greater<int>());
  cout << win[0] << endl;
}
