#include <bits/stdc++.h>
using namespace std;
int n, k;
int dp[5250][210];
long long tv[250], fv[250];
int main() {
  for (int i = 0; i < 5250; i++)
    for (int j = 0; j < 210; j++) {
      dp[i][j] = -999999;
    }
  dp[0][0] = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    long long t;
    cin >> t;
    int c2 = 0, c5 = 0;
    while (!(t % 2)) {
      t /= 2;
      c2++;
    }
    while (!(t % 5)) {
      t /= 5;
      c5++;
    }
    tv[i] = c2;
    fv[i] = c5;
  }
  for (int i = 0; i < n; i++) {
    int it = min(k, i + 1);
    for (int j = it - 1; j >= 0; j--) {
      for (int l = 0; l < 26 * (i + 1); l++) {
        dp[l + fv[i]][j + 1] = max(dp[l + fv[i]][j + 1], dp[l][j] + (int)tv[i]);
      }
    }
  }
  int mp = 0;
  for (int i = 0; i < 5250; i++) {
    mp = max(mp, min(dp[i][k], i));
  }
  cout << mp << '\n';
}
