#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> m >> n;
  string s;
  int sum = 0, k = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    int c = 0;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '1') c++;
    }
    if (c != s.size()) {
      k++;
      if (k > sum) sum = k;
    } else
      k = 0;
  }
  cout << sum;
  return 0;
}
