#include <bits/stdc++.h>
using namespace std;
int main() {
  long long c = 0, cn = 0, cnt = 0;
  long long n, d;
  cin >> n >> d;
  string s;
  for (int i = 0; i < d; i++) {
    cin >> s;
    int l = s.find('0');
    if (l >= 0) {
      c++;
      cnt = max(cnt, c);
    } else
      c = 0;
  }
  cout << cnt << endl;
}
