#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int d = 49 * n;
  int c = 0, arn = 0, maxi = 0;
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    int k = 0;
    for (int j = 0; j < n; j++) {
      k += (int)s[j];
    }
    if (k < d) {
      arn++;
    } else {
      arn = 0;
    }
    maxi = max(maxi, arn);
  }
  cout << maxi;
  return 0;
}
