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