#include <bits/stdc++.h>
using namespace std;
int worker() {
  int n, d;
  scanf("%d%d", &n, &d);
  int mxrun = 0;
  int currun = 0;
  for (int i = 0; i < d; i++) {
    string s;
    cin >> s;
    if (s.find('0') != string::npos)
      currun++;
    else {
      mxrun = max(mxrun, currun);
      currun = 0;
    }
  }
  mxrun = max(mxrun, currun);
  return mxrun;
}
int main() {
  cout << worker() << endl;
  int xx;
  cin >> xx;
  return 0;
}
