#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int sum = 0, rating = 0;
  vector<int> rem;
  rem.reserve(n);
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sum += a;
    rating += a / 10;
    if (a % 10) {
      rem.push_back(10 - a % 10);
    }
  }
  if (sum + k >= n * 100) {
    cout << n * 10;
    return 0;
  }
  sort(rem.begin(), rem.end());
  for (unsigned i = 0; i < rem.size() && k >= rem[i]; ++i) {
    k -= rem[i];
    ++rating;
  }
  rating += k / 10;
  cout << rating;
}
