#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k, coun = 0, v = 0;
  int i = 0;
  int y[2000];
  cin >> n >> k;
  for (; i < n; i++) {
    cin >> y[i];
    if (y[i] + k <= 5) {
      coun++;
      if (coun == 3) {
        v++;
        coun = 0;
      }
    }
  }
  cout << v;
  return 0;
}
