#include <bits/stdc++.h>
using namespace std;
int n, d, ans;
int main() {
  cin >> n >> d;
  int k = 0;
  for (int i = 0; i < d; i++) {
    string s;
    cin >> s;
    if (s.find("0") != string::npos) {
      k++;
      ans = max(ans, k);
    } else {
      ans = max(ans, k);
      k = 0;
    }
  }
  cout << ans;
  return 0;
}
