#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int i, j, k;
int n, m;
vector<int> v, w;
pair<int, int> p;
int comp(int a, int b) { return a % 10 - b % 10; }
int main() {
  cin >> n >> k;
  v.resize(n);
  p = make_pair(-1, 0);
  for (i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end(), [](int a, int b) { return a % 10 > b % 10; });
  for (i = 0; i < n; i++) {
    a = min(k, min(10 - v[i] % 10, 100 - v[i]));
    v[i] += a;
    k -= a;
    if (k == 0) break;
  }
  for (i = 0; i < n; i++) {
    a = min(k, 100 - v[i]);
    v[i] += a;
    k -= a;
    if (k == 0) break;
  }
  k = 0;
  for (i = 0; i < n; i++) k += v[i] / 10;
  cout << k;
}
