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