#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string s[m];
  for (int i = 0; i < m; i++) {
    cin >> s[i];
  }
  int a = 0, maxi = 0;
  for (int i = 0; i < m; i++) {
    if (s[i].find("0") < s[i].size()) {
      a++;
    } else {
      maxi = max(maxi, a);
      a = 0;
    }
  }
  maxi = max(maxi, a);
  cout << maxi << endl;
  return 0;
}
