#include <bits/stdc++.h>
using namespace std;
vector<int> bad;
vector<int> copy2;
int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int g = 0; g < a; g++) {
    int c;
    cin >> c;
    if (c + b <= 5) {
      ans += 1;
    }
  }
  cout << int(ans / 3);
}
