#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int n, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  vector<pair<int, int> > arr(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].second;
    sum += (arr[i].second / 10);
    if (arr[i].second % 10 != 0) {
      arr[i].first = (arr[i].second / 10 + 1) * 10 - arr[i].second;
    } else
      arr[i].first = 0;
  }
  sort(arr.begin(), arr.end());
  for (int i = 0; i < n; i++) {
    if (arr[i].first == 0) continue;
    if (arr[i].first > k) break;
    k -= arr[i].first;
    arr[i].second += arr[i].first;
    sum++;
  }
  for (int i = 0; i < n; i++) {
    while (arr[i].second < 100 && k >= 10) {
      k -= 10;
      sum++;
      arr[i].second += 10;
    }
  }
  cout << sum;
}
