#include <bits/stdc++.h>
using namespace std;
int n, a[200005], need[200005], k, ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] % 10)
      need[i] = 10 - a[i] % 10;
    else
      need[i] = 0;
    ans += a[i] / 10;
  }
  sort(need + 1, need + n + 1);
  for (int i = 1; i <= n; i++)
    if (k >= need[i]) {
      k -= need[i];
      if (need[i]) ans++;
    }
  ans = ans + k / 10;
  ans = min(ans, 10 * n);
  cout << ans;
}
