#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v;
  long long int ans = 0;
  for (long long int i = 1, x; i <= n; i++) {
    cin >> x;
    v.push_back(x % 10 == 0 ? 0 : 10 - (x % 10));
    ans += x / 10;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    if (v[i] == 0) continue;
    if (k >= v[i]) k -= v[i], ans++;
  }
  if (k) {
    ans += (long long int)(k / 10);
  }
  ans = min(ans, 10LL * n);
  cout << ans;
  return 0;
}
