Sort operation SQL Server 2012 I am trying to optimize a query and the sort operation (91% cost) is the costliest operation. Any help will be appreciated.

Query is :

SELECT TOP 1 
    ArchiveType,
    CONVERT(NVARCHAR(30), A.StartTime, 20),
    DateDiff(mi, A.StartTime, 
             IsNull(A.EndTime, CASE 
                                 WHEN ArchiveConfig.STATUS = 1
                                    THEN GetDate()
                                    ELSE ISNULL(B.StartTime, A.StartTime)
                               END)) TimeTaken,
    CASE 
       WHEN A.Error IS NULL AND ArchiveConfig.STATUS &lt;&gt; 1
         THEN - 1
         ELSE A.Error
    END
FROM 
    A WITH (NOLOCK)
INNER JOIN 
    ArchiveConfig WITH (NOLOCK) ON Type = ArchiveType
LEFT JOIN 
    B WITH (NOLOCK) ON LogID = A.ID
WHERE 
    Type = 4
ORDER BY 
    A.ID DESC, B.ID DESC


Table definition:

CREATE TABLE dbo.A
( 
    ID int IDENTITY(1,1) NOT NULL,
    ArchiveType int NOT NULL,
    StartTime datetime NULL,
    EndTime datetime NULL, 
    Error int NULL, 
    NextAction int NULL,

    CONSTRAINT PK_ARCHIVELOG 
       PRIMARY KEY NONCLUSTERED (ID ASC)
             WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, 
                   IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
                    ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) 
);


Table definition b: 

CREATE TABLE dbo.B
( 
    ID int IDENTITY(1,1) NOT NULL, 
    LogID int NOT NULL, 
    StartTime datetime NULL, 
    ObjectType int NOT NULL, 
    ActionType int NOT NULL, 
    TableName varchar(500) NOT NULL,
    PatchNumber int NOT NULL,
    NumberRow int NULL, 
    EndTime datetime NULL, 
    Error int NULL, 

    CONSTRAINT PK_ARCHIVELOGHISTORY 
       PRIMARY KEY NONCLUSTERED (ID ASC)
              WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, 
                    IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
                    ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) 
);

CREATE NONCLUSTERED INDEX [NonClusteredIndex_20160205-153718]
ON dbo.b (LogID) 
INCLUDE (ID, StartTime);


The ArchiveConfig table:

CREATE TABLE dbo.ArchiveConfig
(
    ID int IDENTITY(1,1) NOT NULL
        CONSTRAINT PK_ARCHIVECONFIG 
        PRIMARY KEY NONCLUSTERED
    , Type int NOT NULL
    , PatchSize int NOT NULL
    , FailureAction int NOT NULL
    , RetryCount int NULL
    , ServerName nvarchar(500) NULL
    , DatabaseName nvarchar(500) NULL
    , AuthenticationType int NULL
    , LoginName nvarchar(500) NULL
    , Password nvarchar(500) NULL
    , Runprearchive int NOT NULL
    , Prearchive nvarchar(4000) NULL
    , Runpostarchive int NOT NULL
    , Postarchive nvarchar(4000) NULL
    , ServerIP varchar(20) NOT NULL
    , Status int NOT NULL
    , LinkSrv varchar(500) NULL 
);
First off, the sort operation on a simple query like this will probably always be the most costly.  That's because it's an operation that has to run after it has all of the data returned.  That being said, there are no clustered indexes on the tables.  That means they are heaps and they are storing the data totally unsorted on the disk.  Without adding a clustered index to those tables where your sort is applied, it's unlikely that any changes to your query will improve performance.  

The only other thing that might help(might being a very big might), is move the 'WHERE type = 4' part into the corresponding join statement that it belongs to.  So instead of WHERE type = 4 it would be added to the JOIN ON for ArchiveConfig (I think that's where type comes from at least) as AND type = 4.  The other ON clause for that join seems redundant.  Keep in mind, I doubt very much that this change will actually improve performance but it will make your code a bit cleaner.  

As the others have said, I don't know if it's a good idea to use the (NOLOCK) hint.  I doubt it will improve performance in this case and might result in bad data being returned.