#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    int x = 5 - arr[i];
    if (x >= k) {
      count++;
    }
  }
  cout << count / 3 << endl;
  return 0;
}
