Template Search Top Result Only

I just need the top result from this template?

{% for sensor in states.sensor |
      selectattr('entity_id','in',integration_entities('alexa_media')) |
      rejectattr('state', "search", "unknown" ) |
      rejectattr('state', "search", "unavailable" ) |
      sort(attribute='state') |
      map(attribute='entity_id') -%}
      
        {{ sensor }},

{%- endfor %}

currently gives me

sensor.living_room_echo_next_reminder,sensor.bedroom_echo_next_alarm,sensor.living_room_echo_next_alarm,

I just need the first one in the array.

Found it:

      {% if loop.first %}
        {{ sensor }}
      {% endif %}

The loop is unnecessary…

{{ integration_entities('alexa_media') 
| select('match', '^sensor.') | select('has_value') 
| expand | sort(attribute='state') 
| map(attribute='entity_id') | first }}

Nice, thank you!