#include <bits/stdc++.h>
int mark[105];
using namespace std;
string ch;
int main(void) {
  int check1[105];
  memset(mark, 0, sizeof(mark));
  memset(check1, 0, sizeof(check1));
  int n, d;
  cin >> n >> d;
  for (int i = 0; i < d; i++) {
    cin >> ch;
    for (int j = 0; j < n; j++) {
      if (ch[j] == '0') {
        mark[i] = 1;
        break;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < d; i++) {
  }
  int j = 0;
  for (int i = 0; i < d; i++) {
    if (mark[i] == 1) {
      check1[j]++;
    }
    if (mark[i] == 0) {
      j++;
    }
  }
  int maxx = 0;
  for (int i = 0; i <= j; i++) {
    maxx = max(maxx, check1[i]);
  }
  printf("%d\n", maxx);
}
