#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100005];
  int n, k;
  scanf("%d %d", &n, &k);
  int i;
  int ans = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ans += a[i] / 10;
    a[i] = a[i] % 10;
  }
  sort(a, a + n);
  for (i = n - 1; i >= 0; i--) {
    if (k + a[i] >= 10) {
      ans++;
      k = k - 10 + a[i];
    } else {
      k = 0;
      break;
    }
  }
  if (k != 0) ans += k / 10;
  ans = min(ans, n * 10);
  printf("%d\n", ans);
  return 0;
}
