#include <bits/stdc++.h>
using namespace std;
int calculate_price(int x) { return (x == 100 ? 0 : 10 - (x % 10)); }
bool cmp(pair<int, int> p1, pair<int, int> p2) { return p1.second < p2.second; }
void solve(vector<pair<int, int> > &v, int n, int k) {
  ios_base::sync_with_stdio(false);
  sort(v.begin(), v.end(), cmp);
  int iteration = 0, total = 0, temp;
  int x, y;
  while (true) {
    temp = k;
    for (auto i = 0; i < n; i++) {
      x = v[i].first;
      y = v[i].second;
      if (!iteration) {
        if (y > k)
          total += x / 10;
        else {
          total += (x + y) / 10;
          v[i].first += y;
          k -= y;
          if (x != 100)
            v[i].second = 10;
          else
            v[i].second = 0;
        }
      } else {
        if (x == 100)
          ;
        else if (y <= k) {
          total += y / 10;
          v[i].first += y;
          k -= y;
          if (x != 100)
            v[i].second = 10;
          else
            v[i].second = 0;
        }
      }
    }
    if (k == temp) break;
    sort(v.begin(), v.end(), cmp);
    iteration++;
  }
  cout << total << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, k, x, y;
  vector<pair<int, int> > v;
  cin >> n >> k;
  for (auto i = 0; i < n; i++) {
    cin >> x;
    y = calculate_price(x);
    v.push_back(make_pair(x, y));
  }
  solve(v, n, k);
  return 0;
}
